﻿/// <reference name="MicrosoftAjax.js"/>

///
/// Author: Takamaru Nguyen
/// Date: 21/06/2011
///
function ApplyChangeYN(url, id, obj) {
    var varYN = obj.attr("value");
    $.ajax({
        url: url,
        type: 'POST',
        data: { id: id, pubYN: varYN },
        success: function(html) {
            varYN == "True" ? obj.attr("src", "/Images/icon-32-cancel.png") : obj.attr("src", "/Images/icon-32-apply.png")
            varYN == "True" ? obj.attr("value", "False") : obj.attr("value", "True");
        },
        error: function(mes) {
            alert("Lỗi: " + mes.responseText);
            return false;
        }
    });
}

///
/// Author: Takamaru Nguyen
/// Date: 05/07/2011
///
function AjaxChange(objParent, objRefer, url) {
    $.ajax({
        url: url + $(objParent).val(),
        type: 'POST',
        data: { id: $(objParent).val() },
        success: function(html) {
            $(objRefer).html(html);
        },
        error: function(mes) {
            alert("Lỗi: " + mes.responseText);
            return false;
        }
    });
}